package com.ruoyi.business.service;

import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;

import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;

public interface IProcessService {
     /**
      *
      * 根据上传的文件进行流程定义部署
      * @param filePath
      * @return
      */
     Deployment deploy(String filePath) throws FileNotFoundException;

     /**
      *根据部署Id找到对应的流程定义信息
      *
      * @param deploymentId
      * @return
      */
     ProcessDefinition getProcessDefinitionByDeploymentId(String deploymentId);

     InputStream getBpmnInputStream(String deploymentId);

     InputStream getProcessImg(String deploymentId);

     /**
      * 启动流程
      * @param definitionKey
      * @param variables
      * @return
      */
     ProcessInstance startProcessInstance(String definitionKey,String businessKey , Map<String, Object> variables);

     /**
      *
      * 根据流程实例id获取当前节点任务信息
      * @param id
      * @return
      */
     Task getTaskByProcessInstanceId(String processInstanceId);

     /**
      * 给当前任务设置候选人
      * @param currentTask
      * @param userId
      */
     void addCandidateUser(Task currentTask, Long userId);

     //根据流程实例获取流程图
     InputStream getProcessImgByInstanceId(String instanceId);

     /**
      * 根据流程实例删除流程
      * @param instanceId
      */
     void deleteProcessInstance(String instanceId);

     /**
      * 根据用户ID查询当前用户有多少待办任务
      * @param definitionKey
      * @param userId
      * @return
      */
     Long getTodoTaskCount(String definitionKey, String userId);

     List<Task> selectTodoTaskList(String definitionKey, String userId, Integer startNum, Integer pageSize);


     ProcessInstance getProcessInstanceById(String processInstanceId);
}
